package com.tansun.ruledata.sessionpool;

import org.kie.api.runtime.KieSession;

public class SessionDataPool {
	
	private RuleDataPooledSessionFactory pool = null;

	public SessionDataPool(RuleDataPooledSessionFactory pooledSessionFactory) {
		pool = pooledSessionFactory;
	}

	public KieSession borrowKieSession() throws Exception {
		return pool.create();
	}

	public void returnKieSession(KieSession kieSession) {
		kieSession.destroy();
		kieSession = null;
	}
}
